import Command from '@start-cli-dev/command'
import log from '@start-cli-dev/log'

export class InitCommand extends Command {
  projectName: string

  force: boolean

  constructor(args: any[]) {
    super(args)
    this.projectName = ''
    this.force = false
  }

  init() {
    this.projectName = this.argv[0] as string
    const options = this.argv[this.argv.length - 1] as Record<string, any>
    this.force = options.force
    log.verbose('projectName', this.projectName)
    log.verbose('force', String(this.force))
  }

  exec(): void {
    console.log('lerna 发布测试2')
  }
}

const init: (args: any[]) => void = args => {
  return new InitCommand(args)
}

export default init
